from multiprocessing import Process
from time import sleep


# 子进程传参示例
def worker(sec, name):
    for i in range(3):
        sleep(sec)
        print("I'm %s" % name)
        print("I'm working...")


if __name__ == "__main__":
    # 注意args使用元组传参
    # p = Process(target=worker, args=(2, "Baron"))
    # p = Process(target=worker, kwargs={'name': 'Abby', 'sec': 2})
    p = Process(target=worker, args=(2,), kwargs={'name': 'Frank'})
    p.start()
    p.join()
